import { Entity, PrimaryGeneratedColumn, Column, CreateDateColumn, UpdateDateColumn } from 'typeorm';

/**
 * 展示模块类型枚举
 */
export enum ContentCategory {
  SCENERY = 1,      // 风景
  ACTIVITY = 2,     // 活动
}

/**
 * 内容类型枚举
 */
export enum ContentType {
  IMAGE = 1,        // 图片
  VIDEO = 2,        // 视频
}

@Entity('content_displays')
export class ContentDisplay {
  @PrimaryGeneratedColumn('uuid')
  id!: string;

  @Column({
    type: 'enum',
    enum: ContentCategory,
    comment: '所属模块'
  })
  category!: ContentCategory;

  @Column({
    type: 'varchar',
    length: 100,
    comment: '标题'
  })
  title!: string;

  @Column({
    type: 'enum',
    enum: ContentType,
    comment: '内容类型'
  })
  type!: ContentType;

  @Column({
    type: 'varchar',
    length: 255,
    nullable: true,
    comment: '图片地址'
  })
  imageUrl!: string;

  @Column({
    type: 'varchar',
    length: 255,
    nullable: true,
    comment: '视频地址'
  })
  videoUrl!: string;

  @Column({
    type: 'text',
    nullable: true,
    comment: '描述'
  })
  description!: string;

  @Column({
    type: 'boolean',
    default: true,
    comment: '是否有效'
  })
  isActive!: boolean;

  @Column({
    type: 'int',
    default: 0,
    comment: '排序号'
  })
  sortOrder!: number;

  @Column({
    type: 'varchar',
    length: 36,
    nullable: true,
    comment: '创建人ID'
  })
  createBy!: string;

  @CreateDateColumn({
    type: 'timestamp',
    comment: '创建时间'
  })
  createTime!: Date;

  @Column({
    type: 'varchar',
    length: 36,
    nullable: true,
    comment: '修改人ID'
  })
  updateBy!: string;

  @UpdateDateColumn({
    type: 'timestamp',
    comment: '修改时间'
  })
  updateTime!: Date;
} 